using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.S_ProductLikeCategoryTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HLShop_ProductLikeCategoryTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HLShop_ProductLikeCategoryTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HLShop_ProductLikeCategory";
			dataTableMapping.ColumnMappings.Add("orderby", "orderby");
			dataTableMapping.ColumnMappings.Add("ShopProductClassID", "ShopProductClassID");
			dataTableMapping.ColumnMappings.Add("ShopProductClassName", "ShopProductClassName");
			dataTableMapping.ColumnMappings.Add("ShopID", "ShopID");
			dataTableMapping.ColumnMappings.Add("ProductArrayID", "ProductArrayID");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HLShop_ProductLikeCategory] WHERE (([ShopProductClassID] = @Original_ShopProductClassID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_ShopProductClassID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShopProductClassID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HLShop_ProductLikeCategory] ([ShopID], [ShopProductClassName], [orderby], [ProductArrayID]) VALUES (@ShopID, @ShopProductClassName, @orderby, @ProductArrayID)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ShopProductClassName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ShopProductClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@orderby", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "orderby", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProductArrayID", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ProductArrayID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HLShop_ProductLikeCategory] SET [ShopID] = @ShopID, [ShopProductClassName] = @ShopProductClassName, [orderby] = @orderby, [ProductArrayID] = @ProductArrayID WHERE (([ShopProductClassID] = @Original_ShopProductClassID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShopProductClassName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ShopProductClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@orderby", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "orderby", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ProductArrayID", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ProductArrayID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_ShopProductClassID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShopProductClassID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[8];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT *\r\nFROM HLShop_ProductLikeCategory where ShopID=@ShopID";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[0].Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "SELECT COUNT(*) FROM HLShop_ProductLikeCategory where shopID=@ShopID";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "DELETE FROM HLShop_ProductLikeCategory\r\nWHERE (ShopProductClassID = @ShopProductClassID)";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@ShopProductClassID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopProductClassID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT ProductArrayID, ShopID, ShopProductClassID, ShopProductClassName, orderby FROM HLShop_ProductLikeCategory WHERE (ShopID = @ShopID) AND (ShopProductClassID = @ShopProductClassID)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3].Parameters.Add(new SqlParameter("@ShopProductClassID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopProductClassID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4] = new SqlCommand();
			this._commandCollection[4].Connection = this.Connection;
			this._commandCollection[4].CommandText = "pr_GetProductByShopCategoryID";
			this._commandCollection[4].CommandType = CommandType.StoredProcedure;
			this._commandCollection[4].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@ShopProductClassID", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[5] = new SqlCommand();
			this._commandCollection[5].Connection = this.Connection;
			this._commandCollection[5].CommandText = "INSERT INTO [HLShop_ProductLikeCategory] ( [ShopID], [ShopProductClassName], [orderby]) VALUES ( @ShopID, @ShopProductClassName, @orderby)";
			this._commandCollection[5].CommandType = CommandType.Text;
			this._commandCollection[5].Parameters.Add(new SqlParameter("@ShopID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[5].Parameters.Add(new SqlParameter("@ShopProductClassName", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "ShopProductClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[5].Parameters.Add(new SqlParameter("@orderby", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "orderby", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[6] = new SqlCommand();
			this._commandCollection[6].Connection = this.Connection;
			this._commandCollection[6].CommandText = "UPDATE HLShop_ProductLikeCategory\r\nSET ShopProductClassName = @ShopProductClassName, orderby = @orderby where ShopProductClassID=@ShopProductClassID";
			this._commandCollection[6].CommandType = CommandType.Text;
			this._commandCollection[6].Parameters.Add(new SqlParameter("@ShopProductClassName", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "ShopProductClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[6].Parameters.Add(new SqlParameter("@orderby", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "orderby", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[6].Parameters.Add(new SqlParameter("@ShopProductClassID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ShopProductClassID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[7] = new SqlCommand();
			this._commandCollection[7].Connection = this.Connection;
			this._commandCollection[7].CommandText = "pr_UpdateShopCategrory";
			this._commandCollection[7].CommandType = CommandType.StoredProcedure;
			this._commandCollection[7].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@oldCateGoryid", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@newCateGoryid", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@oldarryProductid", SqlDbType.VarChar, 500, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@newarrayproductid", SqlDbType.VarChar, 500, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable GetProductLikeCategory(int? ShopID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			if (ShopID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = ShopID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable hLShop_ProductLikeCategoryDataTable = new S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable();
			this.Adapter.Fill(hLShop_ProductLikeCategoryDataTable);
			return hLShop_ProductLikeCategoryDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable GetShop_ProductLikeCategorybyCategoryIDShopID(int? ShopID, int ShopProductClassID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			if (ShopID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = ShopID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			this.Adapter.SelectCommand.Parameters[1].Value = ShopProductClassID;
			S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable hLShop_ProductLikeCategoryDataTable = new S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable();
			this.Adapter.Fill(hLShop_ProductLikeCategoryDataTable);
			return hLShop_ProductLikeCategoryDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable GetShopProductByShopProductCategoryID(int? ShopProductClassID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[4];
			if (ShopProductClassID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[1].Value = ShopProductClassID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
			}
			S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable hLShop_ProductLikeCategoryDataTable = new S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable();
			this.Adapter.Fill(hLShop_ProductLikeCategoryDataTable);
			return hLShop_ProductLikeCategoryDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_ProductLikeCategory.HLShop_ProductLikeCategoryDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_ProductLikeCategory dataSet)
		{
			return this.Adapter.Update(dataSet, "HLShop_ProductLikeCategory");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual object CountNumsByShopID(int? ShopID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			if (ShopID.HasValue)
			{
				sqlCommand.Parameters[0].Value = ShopID.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			object obj;
			try
			{
				obj = sqlCommand.ExecuteScalar();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			object result;
			if (obj == null || obj.GetType() == typeof(System.DBNull))
			{
				result = null;
			}
			else
			{
				result = obj;
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteProductLikeCategory(int ShopProductClassID)
		{
			SqlCommand sqlCommand = this.CommandCollection[2];
			sqlCommand.Parameters[0].Value = ShopProductClassID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Insert, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int InsertProductLikeCategory(int? ShopID, string ShopProductClassName, int? orderby)
		{
			SqlCommand sqlCommand = this.CommandCollection[5];
			if (ShopID.HasValue)
			{
				sqlCommand.Parameters[0].Value = ShopID.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			if (ShopProductClassName == null)
			{
				sqlCommand.Parameters[1].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[1].Value = ShopProductClassName;
			}
			if (orderby.HasValue)
			{
				sqlCommand.Parameters[2].Value = orderby.Value;
			}
			else
			{
				sqlCommand.Parameters[2].Value = System.DBNull.Value;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Update, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int UpdateProductLikeCategory(string ShopProductClassName, int? orderby, int ShopProductClassID)
		{
			SqlCommand sqlCommand = this.CommandCollection[6];
			if (ShopProductClassName == null)
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = ShopProductClassName;
			}
			if (orderby.HasValue)
			{
				sqlCommand.Parameters[1].Value = orderby.Value;
			}
			else
			{
				sqlCommand.Parameters[1].Value = System.DBNull.Value;
			}
			sqlCommand.Parameters[2].Value = ShopProductClassID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int UpdateShopCategrory(int? oldCateGoryid, int? newCateGoryid, string oldarryProductid, string newarrayproductid)
		{
			SqlCommand sqlCommand = this.CommandCollection[7];
			if (oldCateGoryid.HasValue)
			{
				sqlCommand.Parameters[1].Value = oldCateGoryid.Value;
			}
			else
			{
				sqlCommand.Parameters[1].Value = System.DBNull.Value;
			}
			if (newCateGoryid.HasValue)
			{
				sqlCommand.Parameters[2].Value = newCateGoryid.Value;
			}
			else
			{
				sqlCommand.Parameters[2].Value = System.DBNull.Value;
			}
			if (oldarryProductid == null)
			{
				sqlCommand.Parameters[3].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[3].Value = oldarryProductid;
			}
			if (newarrayproductid == null)
			{
				sqlCommand.Parameters[4].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[4].Value = newarrayproductid;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
